/**
 * @Date 2020-06-28 14:46:37
 * @Remark
 */

// lib
// config
// script & methods & public
// http
// service
import {
  simplePageService,
  simpleObjectService,
  simpleBooleanService,
} from "@/public/service/simple.service";
// import store from "@/store";
// api
import {
  ReqCompanyPage,
  ResCompanyPage,
  API_COMPANY_PAGE,
  ReqCompanyAdd,
  API_COMPANY_ADD,
  ResCompanyAdd,
  API_COMPANY_UPDATE,
  ReqCompanyUpdate,
  ResCompanyUpdate,
  API_COMPANY_DEL,
  ReqCompanyDel,
  ResCompanyDel,
} from "./api";
// interface && type && class
import { CompanyDto } from "./model";
import logUtils from "@/utils/logUtils";
// 其它

// 菜单分页
export async function getCompanyPageService(params: ReqCompanyPage) {
  return simplePageService<ReqCompanyPage, ResCompanyPage, CompanyDto>(API_COMPANY_PAGE, params);
}

// 菜单添加
export async function addCompanyService(params: ReqCompanyAdd) {
  logUtils.log("params", params);
  return simpleObjectService<ReqCompanyAdd, ResCompanyAdd, CompanyDto>(API_COMPANY_ADD, params);
}

// 菜单编辑
export async function updateCompanyService(params: ReqCompanyUpdate) {
  return simpleObjectService<ReqCompanyUpdate, ResCompanyUpdate, CompanyDto>(
    API_COMPANY_UPDATE,
    params,
  );
}

// 菜单删除
export async function delCompanyService(id: number) {
  return simpleBooleanService<ReqCompanyDel, ResCompanyDel>(API_COMPANY_DEL, {
    id,
  });
}
